home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / MyMachineNames.p < prev    next >
Encoding:
Text File  |  1996-11-03  |  719 b   |  45 lines  |  [TEXT/CWIE]

  1. unit MyMachineNames;
  2.  
  3. interface
  4.  
  5.     uses
  6.         Types;
  7.  
  8.     const
  9.         owner_id = -16096;
  10.         machine_id = -16413;
  11.  
  12.     function GetOwnerName: Str255;
  13.     function GetMachineName: Str255;
  14.  
  15. implementation
  16.  
  17.     uses
  18.         TextUtils;
  19.         
  20.     function GetName (id1, id2: integer): Str255;
  21.         var
  22.             sh: StringHandle;
  23.     begin
  24.         sh := GetString(id1);
  25.         if sh = nil then begin
  26.             sh := GetString(id2);
  27.         end;
  28.         if sh <> nil then begin
  29.             GetName := sh^^; { Don't release it, someone else may be using it }
  30.         end else begin
  31.             GetName := 'unnamed';
  32.         end;
  33.     end;
  34.  
  35.     function GetOwnerName: Str255;
  36.     begin
  37.         GetOwnerName := GetName(owner_id, machine_id);
  38.     end;
  39.  
  40.     function GetMachineName: Str255;
  41.     begin
  42.         GetMachineName := GetName(machine_id, owner_id);
  43.     end;
  44.  
  45. end.